package algorithms.sorting


import org.junit.jupiter.api.Test
import redirectSystemIn
import redirectSystemOut
import java.io.BufferedReader
import java.io.InputStreamReader

class BigSortingTests {
    @Test
    fun bigSortingTest() {
        redirectSystemIn(this.javaClass) {
            val reader = BufferedReader(InputStreamReader(System.`in`), 1024 * 1024)

            redirectSystemOut {

                val n = reader.readLine().trim().toInt()

                val unsorted = Array<String>(n) { reader.readLine() }

                val result = bigSorting(unsorted)

                println(result.joinToString("\n"))

                for (i in 0 until n) {
                    it.add(reader.readLine())
                }

            }
        }
    }
}